package com.esunrising.esungsc.dao;

import com.esunrising.esungsc.entity.BFCustomItem;
import com.esunrising.esungsc.entity.SysConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

@Repository
public interface SysConfigDao extends JpaRepository<SysConfig, String> {

    @Query("select t from #{#entityName} t where t.configKey = ?1")
    @Transactional(readOnly = true)
    Optional<SysConfig> findByConfigKey(String configKey);

    @Query("select t.configValue from #{#entityName} t where t.configKey = ?1")
    @Transactional(readOnly = true)
    String findConfigValueByConfigKey(String configKey);
}